package cn.vivi.service.impl;

import java.sql.SQLException;
import java.util.List;

import cn.vivi.domain.User;
import cn.vivi.mapper.UserMapper;
import cn.vivi.service.UserService;

public class UserServiceImpl implements UserService {

	private UserMapper userMapper = new UserMapper();

	@Override
	public List<User> list() {
		try {
			return userMapper.findAll();
		} catch (SQLException e) {
			e.printStackTrace();
			throw new RuntimeException(e.getMessage());
		}
	}

	@Override
	public User login(User user) {
		try {
			return userMapper.findOne(user);
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}
}
